nodejs18.x/hello-gql/{{cookiecutter.project_name}}/template.yaml (97 lines of code) (raw):
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
{{ cookiecutter.project_name }}
Sample SAM Template for {{ cookiecutter.project_name }}
Resources:
PostsTable:
Type: AWS::Serverless::SimpleTable
Greeter:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: greeter/
Handler: app.lambdaHandler
Runtime: nodejs18.x
{%- if cookiecutter.architectures.value != []%}
Architectures:
{%- for arch in cookiecutter.architectures.value %}
- {{arch}}
{%- endfor %}
{%- endif %}
HelloWorldGraphQLApi:
Type: AWS::Serverless::GraphQLApi
Properties:
SchemaUri: ./gql/schema.graphql
Auth:
Type: API_KEY
ApiKeys:
MyApiKey:
Description: my api key
DataSources:
DynamoDb:
Posts:
TableName: !Ref PostsTable
TableArn: !GetAtt PostsTable.Arn
Lambda:
Greeter:
FunctionArn: !GetAtt Greeter.Arn
Functions:
preprocessPostItem:
Runtime:
Name: APPSYNC_JS
Version: 1.0.0
DataSource: NONE
CodeUri: ./gql/preprocessPostItem.js
createPostItem:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
DataSource: Posts
CodeUri: ./gql/createPostItem.js
getPostFromTable:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
DataSource: Posts
CodeUri: ./gql/getPostFromTable.js
greet:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
DataSource: Greeter
CodeUri: ./gql/greet.js
Resolvers:
Mutation:
addPost:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
Pipeline:
- preprocessPostItem
- createPostItem
Query:
getPost:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
Pipeline:
- getPostFromTable
sayHello:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
Pipeline:
- greet
sayGoodbye:
Runtime:
Name: APPSYNC_JS
Version: "1.0.0"
Pipeline:
- greet
Outputs:
HelloWorldGraphQLApi:
Description: HelloWorldGraphQLApi endpoint URL for Prod environment
Value: !GetAtt HelloWorldGraphQLApi.GraphQLUrl
HelloWorldGraphQLApiMyApiKey:
Description: API Key for HelloWorldGraphQLApi
Value: !GetAtt HelloWorldGraphQLApiMyApiKey.ApiKey